﻿/* 
 * TABLE: dbo.BooksByCategory 
 */

/* 
 * TABLE: BooksByCategory 
 */

CREATE TABLE BooksByCategory(
    CategoryId    int    NOT NULL,
    BookId        int    NOT NULL,
    CONSTRAINT PK_BooksByCategory PRIMARY KEY NONCLUSTERED (CategoryId, BookId)
)
GO
ALTER TABLE BooksByCategory ADD CONSTRAINT FKCategories_BooksByCategory 
    FOREIGN KEY (CategoryId)
    REFERENCES Categories(CategoryId)
GO
/* 
 * TABLE: dbo.BooksByCategory 
 */

/* 
 * TABLE: BooksByCategory 
 */

ALTER TABLE BooksByCategory ADD CONSTRAINT FKBooks_BooksByCategory 
    FOREIGN KEY (BookId)
    REFERENCES Books(BookId)